package com.allinpay.usdk.dev.aidl;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 作者 Y_MS
 * Created by ${APEN} on 2017/5/24.
 * GitHub：https://github.com/cxydxpx
 */

public class BasicInfo implements Parcelable{
    //    sn	String	厂商终端序号
    private String sn;
//    model	String	终端机型
    private String model;
//    vendor	String	终端提供商
    private String vendor;
//    certification	String	入网许可证
    private String certification;
//    versionCode	int	设备服务版本
    private int versionCode;
//    aipSn	String	通联终端序号
    private String aipSn;
//    32位长度，建议是AIP+厂商+型号+硬件版本+设备序列号
//    若长度不足32位需左补0
//    workMode	String	终端工作模式（8位）
    private String workMode;
//    第1位：终端双向认证模式：
//    0 - 上层业务认证
//    1 - 终端硬件认证
//    2-8位默认为全0，功能待定


    public BasicInfo() {
    }



    public void setSn(String sn) {
        this.sn = sn;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public void setVendor(String vendor) {
        this.vendor = vendor;
    }

    public void setCertification(String certification) {
        this.certification = certification;
    }

    public void setVersionCode(int versionCode) {
        this.versionCode = versionCode;
    }

    public void setAipSn(String aipSn) {
        this.aipSn = aipSn;
    }

    public void setWorkMode(String workMode) {
        this.workMode = workMode;
    }

    public String getSn() {
        return sn;
    }

    public String getModel() {
        return model;
    }

    public String getVendor() {
        return vendor;
    }

    public String getCertification() {
        return certification;
    }

    public int getVersionCode() {
        return versionCode;
    }

    public String getAipSn() {
        return aipSn;
    }

    public String getWorkMode() {
        return workMode;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(sn);
        dest.writeString(model);
        dest.writeString(vendor);
        dest.writeString(certification);
        dest.writeInt(versionCode);
        dest.writeString(aipSn);
        dest.writeString(workMode);
    }

    /**
     * 参数是一个Parcel,用它来存储与传输数据
     * @param dest
     */
    public void readFromParcel(Parcel dest) {
        //注意，此处的读值顺序应当是和writeToParcel()方法中一致的
        sn = dest.readString();
        model = dest.readString();
        vendor = dest.readString();
        certification = dest.readString();
        versionCode = dest.readInt();
        aipSn = dest.readString();
        workMode = dest.readString();
    }


    protected BasicInfo(Parcel in) {
        sn = in.readString();
        model = in.readString();
        vendor = in.readString();
        certification = in.readString();
        versionCode = in.readInt();
        aipSn = in.readString();
        workMode = in.readString();
    }

    public static final Creator<BasicInfo> CREATOR = new Creator<BasicInfo>() {
        @Override
        public BasicInfo createFromParcel(Parcel in) {
            return new BasicInfo(in);
        }

        @Override
        public BasicInfo[] newArray(int size) {
            return new BasicInfo[size];
        }
    };
}
